
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )

function ENT:Initialize()

	// This stuff is used by the base weapon ent
	self.Model = "models/weapons/w_rocket_launcher.mdl"
	self.MuzzlePos = self:GetPos() + (self:GetForward() * 10)
	self.Sound1 = Sound("npc/env_headcrabcanister/launch.wav")
	self.Rof = .6
	self.ReloadTime = 4.5
	self.Clip = 10
	self.ReloadSound = Sound("weapons/crossbow/bolt_load1.wav")
	
	util.PrecacheModel(self.Model)
	self:SetModel(self.Model)
	
	self.CurClip = self.Clip //this keeps the weapon from needing a reload when it spawns
	
	//Set ammo values clientside
	self:GetOwner():SetNetworkedFloat("maxvehicleammo",self.Clip)
	self:GetOwner():SetNetworkedFloat("vehicleammo",self.CurClip)
	
end

function ENT:Setup(offset)
	if self:GetOwner() == nil then return end
	self.Offset = offset	
end

function ENT:GetOffset()
return self.Offset end

function ENT:GetWepAngles()
	local ang = self:GetAngles()
	//local ang = self:LocalToWorldAngles(self.Offset)
return ang end

function ENT:GetMuzzlePos()
	local vec = self:GetPos()
	vec = vec + self:GetTrueForward() * 50
	vec = vec + self:GetTrueRight() * -2
return vec end

function ENT:GetTrueUp()
	return self:GetUp()
end

function ENT:GetTrueForward()
	return self:GetForward()
end

function ENT:GetTrueRight()
	return self:GetRight()
end

function ENT:Think()
	if self:GetOwner() != NULL and self:GetOwner() != nil then
		if self:GetOwner():KeyDown(IN_ATTACK) then
			if self:IsReloading() then return end
			if self:CanFire() then
				self:FireRocket( "rocket_dhs", "muzzle_normal", self.Sound1, math.random(120,140) )
				//self:DropBomb( "bomb_impactbomb", self.DropDelay, self.Sound1, self.Pitch  ) //snd2 optional
			end
		end
	end
end